﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Com.ZX
{
	/// <summary>
	/// 单例类基类
	/// </summary>
	/// <typeparam name="T"></typeparam>
	public abstract class BaseSingleton<T>:IBase where T : class, new()
	{
		protected static T _Instance;
		public static T inst
		{
			get
			{
				if (_Instance == null)
				{
                    _Instance = new T();
    			}
				return _Instance;
			}
		}
		public BaseSingleton()
		{
			//onInit();
			CustomDebug.Log("base construtor");
		}
		~BaseSingleton()
		{
			onDestroy();
		}

		public virtual void onDestroy()
		{
			//throw new NotImplementedException();
		}

		public virtual void onInit()
		{
			CustomDebug.Log("base on init");
			//throw new NotImplementedException();
		}
	}
	
}
